package com.snopy.controller;

import com.snopy.service.HelloService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author snopy
 * @version 1.0.0
 * @classname HelloController
 * @description
 * @email 77912204@qq.com
 * @date 2022/03/11 20:10
 */
@RestController
@Slf4j
public class HelloController {
    @Autowired
    private HelloService service;
    @GetMapping("sayHi")
    public String sayHello(){
       String result = service.sayHi();
       log.info("port:{}",result);
       return result;
    }
    @PostMapping("sayHi")
    public String sayHello(@RequestParam("msg") String msg){
        String result = service.sayHi(msg);
        log.info("port:{}",result);
        return result;
    }
}
